<script lang="ts">
  import { IconSize, icons$ } from "./conf";
  import TextIcon from "./TextIcon.svelte";
  export let name: string = "";
  export let size: string = "default";
  export let className: string = "";
  $: icon = $icons$.find(i => i.name === name)
  $: iconSize = IconSize[size] || IconSize["default"]
</script>
{#if icon }
<svelte:component this={icon.component}  className="{className} rounded-full {iconSize}" />
{:else}
  <TextIcon {name} class={$$restProps.class || ''}>
    <svelte:fragment slot="text-icon" >
      <slot></slot>
    </svelte:fragment>
  </TextIcon>
{/if}